package com.bishe.supermarket.controller;

import com.bishe.supermarket.pojo.Profit;
import com.bishe.supermarket.service.FinanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
public class FinanceController {

    @Autowired
    AdminLoginController adminLogin;

    @Autowired
    FinanceService financeService;

    @RequestMapping("finance")
    public String finance(HttpSession httpSession){
//        List<Profit> list = financeService.selectProfit();

        List<Profit> list = financeService.selectProfit();
        int totalProfit = financeService.totalProfit();
        httpSession.setAttribute("list",list);
        httpSession.setAttribute("totalProfit",totalProfit);
        System.out.println("我是finance"+totalProfit);
//    model.addAttribute("userName",userName);
//    model.addAttribute("list",list);

    return "financeManage";
    }
}
